<?php
    require_once("./DButil.php");
    $loginName=$_REQUEST["loginName"];
    $password=$_REQUEST["password"];
    $phone=$_REQUEST["phone"];
    $headImage = $_FILES["headImage"];
    var_dump($headImage);
    $path="D:/Users/User/Desktop/ajax/images/";
    // $path="E:/php2/ajax/images/";
    $oldName = $headImage["name"];
    echo $oldName;
    $newName = time() . mt_rand(1000, 9999) . substr($oldName, mb_strpos($headImage, "."));
    // 移动文件到指定位置
    move_uploaded_file($headImage["tmp_name"], $path . $newName);
    // 返回 通过网络访问该图片的 url
    echo "/ajax/images/" . $newName;
    echo '<br>';
    echo '注册成功！';
    $sql="insert into t_user  (u_login_name,u_password,u_image_url,u_phone) values('{$loginName}','{$password}','{$newName}','{$phone}')";
    $arr=update($sql);
?>